<template>
  <div :class="theme" class="be-logo">
    <a class="be-logo-inner" :href="href">
      <img v-if="src" class="logo-pic" :alt="text" :src="src" />
      <span v-if="!collapsed" class="text">{{ text }}</span>
    </a>
  </div>
</template>

<script setup lang="ts">
// 定义 Props 接口
interface Props {
  /** 是否收起文本 */
  collapsed?: boolean
  /** Logo 跳转地址 */
  href?: string
  /** Logo 图标 */
  src?: string
  /** Logo 文本 */
  text?: string
  /** Logo 主题 */
  theme?: string
}

// 设置组件选项
defineOptions({
  name: 'BeLogo'
})

// props
withDefaults(defineProps<Props>(), {
  collapsed: false,
  href: 'javascript:void 0',
  logoSize: 32,
  src: '',
  text: '',
  theme: 'light'
})
</script>

<style lang="scss" scoped>
.be-logo {
  width: 100%;
  height: 50px;
  .be-logo-inner {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    padding-right: 12px;
    padding-left: 12px;
    overflow: hidden;
  }
  .logo-pic {
    position: relative;
    width: 32px;
    background-color: transparent;
    border-radius: 0;
  }
  .text {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
  }
}
</style>
